<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        img{
display: inline-block;
position: absolute;
top: 200px;
left: 500px;
        }
        button{
            position: absolute;
            top:195px;
            right: 495px;
            text-align: center;
        
            
        }
    </style>
</head>
<body>
    <button>删除</button>
    <img src="tao.png">

    <script>
        var img=document.querySelector("img");
        var btn=document.querySelector("button");
        btn.onclick=function(){
         img.parentNode.removeChild(img);
         btn.parentNode.removeChild(btn);
        }
    </script>
</body>
</html>